from django.contrib import admin

from models import Cliente
from models import Pedido
from models import Entregador

class PedidoInline(admin.TabularInline):
	model = Pedido

class PedidoAdmin(admin.ModelAdmin):
	list_display = ["pizza", "data_pedido", "entregue"]
	search_fields = ["cliente__nome"]
	list_filter = ["pizza", "data_pedido"]
	ordering = ["-data_pedido"]

class ClienteAdmin(admin.ModelAdmin):
	list_display = ["id", "nome", "telefone"]
	list_display_links = ["id", "nome"]
	inlines = [PedidoInline]

admin.site.register(Cliente, ClienteAdmin)
admin.site.register(Pedido, PedidoAdmin)
admin.site.register(Entregador)
